<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>面向对象 demo</title>
<link rel="stylesheet" href="css/base.css" />
<script>
/*工厂模式 构建函数*/
function creatObject( name, sex ){		//集中实例化的函数
	var obj = new Object();
	obj.name = name;
	obj.sex  = sex;
	obj.showName = function (){
		alert("大家好，我叫 " + this.name)
	}
	obj.showSex = function (){
		alert("我是 " + this.sex + "的。")
	}
	return obj;
}

var p1 = creatObject("yaozx","男");
var p2 = creatObject("ruby","女");

p1.showName();
p2.showName();
</script>
</head>
<body>
<div class="wrap">
	<h2 class="wrap-h2">javascript 面向对象！</h2>
	<div class="wrap-main wrap-index">
		<!--内容写这里-->
		
	</div>
</div>
</body>
</html>
